import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    AuthKey: 'roleManage:find',      该页面进入的权限码
    keepAlive: true,                  该页面需要缓存(注意: name值必须设置 与组件内部name 一致 配合isback属性)
    isback :  false
  }
* AuthKey: 'roleManage:find'      该页面进入的权限码
**/
export const constantRouterMap = [
  { path: '/micro/vueApply/bigscreen/list', component: () => import('@/views/bigscreen/index'), hidden: true, meta: { requireAuth: true }},
  { path: '/micro/vueApply/out/bigscreen/designer/new', component: () => import('@/views/bigscreen/designer'), hidden: true, meta: { requireAuth: true }},
  { path: '/micro/vueApply/out/bigscreen/designer/:id', component: () => import('@/views/bigscreen/designer'), hidden: true, meta: { requireAuth: true }},
  { path: '/micro/vueApply/out/bigscreen/viewer/:id', component: () => import('@/views/bigscreen/viewer'), hidden: true, meta: { requireAuth: true }},
  { path: '*', redirect: '/micro/vueApply/bigscreen/list', hidden: true },
  // { path: '/404', component: () => import('@/views/404'), hidden: true },
  // {
  //   path: '/micro/vueApply',
  //   redirect: '/micro/vueApply/bigscreen/list',
  //   name: 'micro',
  //   component: () => import('../components/layout/MainLayout.vue'),
  //   children: [
  //     {
  //       path: 'bigscreen',
  //       name: 'bigscreen',
  //       meta: {
  //         title: '数据大屏'
  //       },
  //       component: {
  //         render: h => h('router-view')
  //       },
  //       children: [
  //         {
  //           path: 'list',
  //           name: 'list',
  //           meta: {
  //             title: '数据大屏'
  //           },
  //           component: () => import('@/views/bigscreen/index')
  //         },
  //         {
  //           path: 'designer',
  //           name: 'designer',
  //           meta: {
  //             title: '数据大屏设计'
  //           },
  //           component: () => import('@/views/bigscreen/designer')
  //         },
  //         {
  //           path: 'viewer',
  //           name: 'viewer',
  //           meta: {
  //             title: '数据大屏预览'
  //           },
  //           component: () => import('@/views/bigscreen/viewer')
  //         },
  //       ]
  //     }
  //   ]
  // },
]
console.log('window.__POWERED_BY_QIANKUN__', window.__POWERED_BY_QIANKUN__);
export default new Router({
  mode: window.__POWERED_BY_QIANKUN__ ? 'history' : 'hash', //后端支持可开
  // base: window.__POWERED_BY_QIANKUN__ ? '/vue' : '/',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
